package com.tim.source.db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

public class SqlUtil {
	public static ResultSet getResultset(String sql, List<Object> params) {
		Connection conn = ConnectionManager.getConnection();
		ResultSet rst = null;
		try {
			PreparedStatement pstm = conn.prepareStatement(sql);
			for (int i = 0; i < params.size(); i++) {
				pstm.setObject(i + 1, params.get(i));
			}
			rst = pstm.executeQuery();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return rst;
	}
}
